/*******************************************************************************
 * Package: com.hngtrust.iir.company.controller
 * Type:    FinancialScoringController
 * Date:    2021/4/21 9:14
 *
 * Copyright (c) 2021 HUANENG GUICHENG TRUST CORP.,LTD All Rights Reserved.
 *
 * You may not use this file except in compliance with the License.
 *******************************************************************************/
package com.hngtrust.iir.company.controller;

import com.hngtrust.framework.bind.ResponseInfo;
import com.hngtrust.iir.company.controller.vo.CompFinanceTrendReqVO;
import com.hngtrust.iir.company.controller.vo.ListComprehensiveRespVO;
import com.hngtrust.iir.company.controller.vo.ListContrastReqVO;
import com.hngtrust.iir.company.controller.vo.ListContrastRespVO;
import com.hngtrust.iir.company.controller.vo.ListContrastTrendReqVO;
import com.hngtrust.iir.company.controller.vo.ListContrastTrendRespVO;
import com.hngtrust.iir.company.controller.vo.ListFiancialDataReqVo;
import com.hngtrust.iir.company.controller.vo.ListFiancialReqVo;
import com.hngtrust.iir.company.controller.vo.ListFinanceGradeRespVO;
import com.hngtrust.iir.company.controller.vo.ListFinanceGradeTrendRespRespVO;
import com.hngtrust.iir.company.service.FinancialScoringService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 公司财务评价指标信息
 *
 * @author Wanghan
 * @date 2021/4/21 9:14
 */

@Slf4j
@Api(tags = "公司财务评价指标信息")
@RestController
@RequestMapping("/company")
public class FinancialScoringController {
    
    @Autowired
    private FinancialScoringService financialScoringService;
    
    /**
     * 财务综合评分
     */
    @ApiOperation(value = "财务综合评分", notes = "财务综合评分")
    @PostMapping("/list-comprehensive")
    public ResponseInfo<List<ListComprehensiveRespVO>> listComprehensive(
            @ApiParam(value = "财务综合评分") @Valid @RequestBody ListFiancialReqVo req) {
        log.info("FinancialScoringController.listComprehensive start...");
        
        List<ListComprehensiveRespVO> listComprehensiveRespVO =  financialScoringService.getComprehensiveRespVO(req);
        
        ResponseInfo<List<ListComprehensiveRespVO>> data = new ResponseInfo<>();
        data.setData(listComprehensiveRespVO);
        
        return data;
    }
    
    /**
     * 评分详情
     */
    @ApiOperation(value = "评分详情", notes = "评分详情")
    @PostMapping("/list-scoring-details")
    public ResponseInfo<List<ListFinanceGradeRespVO>> listScoringDetails(
            @ApiParam(value = "评分详情") @Valid @RequestBody ListFiancialDataReqVo req) {
        log.info("FinancialScoringController.listScoringDetails start...");
    
        List<ListFinanceGradeRespVO> listFinanceGradeRespVO =  financialScoringService.getFinanceGradeRespVO(req);
        ResponseInfo<List<ListFinanceGradeRespVO>> data = new ResponseInfo<>();
        data.setData(listFinanceGradeRespVO);
        
        return data;
    }
    
    /**
     *评分详情走势图
     */
    @ApiOperation(value = "评分详情走势图", notes = "评分详情走势图")
    @PostMapping("/list-comprehensive-trend")
    public ResponseInfo<List<ListFinanceGradeTrendRespRespVO>> listComprehensiveTrend(
            @ApiParam(value =  "评分详情走势图") @Valid @RequestBody CompFinanceTrendReqVO req){
        log.info("FinanceController.listComprehensiveTrend start...");
        
        List<ListFinanceGradeTrendRespRespVO> listFinanceGradeTrendRespRespVO = financialScoringService.getFinanceGradeTrendRespVO(req);
        
        ResponseInfo<List<ListFinanceGradeTrendRespRespVO>> data = new ResponseInfo<>();
        data.setData(listFinanceGradeTrendRespRespVO);
        return data;
    }
    
    /**
     * 同业对比
     */
    @ApiOperation(value = "同业对比", notes = "同业对比")
    @PostMapping("/list-contrast")
    public ResponseInfo<List<ListContrastRespVO>> listContrast(
            @ApiParam(value =  "同业对比") @Valid @RequestBody ListContrastReqVO req){
        log.info("FinanceController.listContrast start...");
        
        List<ListContrastRespVO> listContrastRespVO =  financialScoringService.getContrastRespVO(req);
        
        ResponseInfo<List<ListContrastRespVO>> data = new ResponseInfo<>();
        data.setData(listContrastRespVO);
        return data;
    }
    
    /**
     * 同业对比走势图
     */
    @ApiOperation(value = "同业对比走势图", notes = "同业对比走势图")
    @PostMapping("/list-contrast-trend")
    public ResponseInfo<List<ListContrastTrendRespVO>> listContrastTrend(
            @ApiParam(value =  "同业对比走势图") @Valid @RequestBody ListContrastTrendReqVO req){
        log.info("FinanceController.listContrastTrend start...");
        
        List<ListContrastTrendRespVO> listContrastTrendRespVO =  financialScoringService.getContrastTrendRespVO(req);
    
        ResponseInfo<List<ListContrastTrendRespVO>> data = new ResponseInfo<>();
        data.setData(listContrastTrendRespVO);
        return data;
    }
    
    
}
